/*************************************************************************
	> File Name: oj-258.cpp
	> Author: Wang Bo
	> Mail: 1276106221@qq.com
	> Created Time: 2021年02月04日 星期四 08时23分49秒
 ************************************************************************/
#include <iostream>
#include <cstdio>
using namespace std;

int n, nums[105][105], sum[105][105], ans;

int main() {
    scanf("%d", &n);    
    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= n; ++j) {
            scanf("%d", &nums[i][j]);
            sum[i][j] = nums[i][j] + sum[i - 1][j];
        }
    }
    for (int i = 1; i <= n; ++i) { //枚举首行
        for (int j = i; j <= n; ++j) { //枚举末行
            int temp = 0, now = 0;
            for (int k = 1; k <= n; ++k) { //枚举列
                now = sum[j][k] - sum[i - 1][k]; //第i到j行间第k列的和
                if (temp >= 0) temp += now;
                else temp = now;
                if (temp > ans) ans = temp;
            }
        }
    }
    printf("%d", ans);
    return 0;
}
